package views;

import controllers.Vehicle;
import java.util.ArrayList;

import javax.swing.table.DefaultTableModel;

public class VehicleTableModel extends DefaultTableModel {
	
	private ArrayList<Vehicle> vehicles;
	private final int NUM_COLS = 3;
	
	public VehicleTableModel(ArrayList<Vehicle> vehicles){
		super();
		this.vehicles = vehicles;
		setColumnCount(NUM_COLS);
		Object[] rowdata;
		for(int i=0; i< vehicles.size();i++){
			rowdata = new Object[]{vehicles.get(i).getName(),
					vehicles.get(i).getVehicleTypeName(),
					vehicles.get(i).isBrokenDown()};
			insertRow(i, rowdata);
		}
	}

}
